package me.zhengjie.dao;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.sql.Timestamp;
import java.util.List;

/**
 * 载具表
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("iws_container")
public class ContainerDao {

    @ApiModelProperty(value = "载具id")
    @TableField("id")
    private String id;

    @ApiModelProperty(value = "载具类型（料箱/托盘）")
    @TableField("type")
    private String type;

    @ApiModelProperty(value = "载具位置（库内/库外）")
    @TableField("local")
    private String local;

    @ApiModelProperty(value = "冻结（1冻结/0启用）")
    @TableField("disable")
    private Integer disable;

    @ApiModelProperty(value = "是否有货（1冻结/0启用）")
    @TableField("is_exist")
    private Integer isExist;

    @ApiModelProperty(value = "动碰id")
    @TableField("move_id")
    private String moveId;

    @ApiModelProperty(value = "物料的唯一标识")
    @TableField("item_bar_code")
    private String itemBarCode;

    @ApiModelProperty(value = "条码是否损坏（0可用/1损坏）")
    @TableField("bar_code_bad")
    private Integer barCodeBad;

    @ApiModelProperty(value = "载具是否损坏（0可用/1损坏）")
    @TableField("container_bad")
    private Integer containerBad;

    @ApiModelProperty(value = "异常状态时间更新")
    @TableField("abnormal_date")
    private Timestamp abnormalDate;

    @ApiModelProperty(value = "载具重量")
    @TableField("weight")
    private Double weight;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_date")
    private Timestamp createDate;

    @ApiModelProperty(value = "更新时间")
    @TableField("update_date")
    private Timestamp updateDate;

    @ApiModelProperty(value = "载具长")
    @TableField("w_long")
    private Double wLong;

    @ApiModelProperty(value = "载具宽")
    @TableField("w_wide")
    private Double wWide;

    @ApiModelProperty(value = "载具高")
    @TableField("w_tall")
    private Double wTall;

    @ApiModelProperty(value = "详情列表")
    @TableField(exist = false)
    private List<MesNest> detail;

    @ApiModelProperty(value = "仓库")
    @TableField(exist = false)
    private String warehouse;


    @ApiModelProperty(value = "出入库锁定(0正常/1锁定)")
    @TableField("ion_lock")
    private Integer ionLock;

    public void copy(ContainerDao source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
